export function timestampToTime(timestamp, type = "date") {
  if (!timestamp) return false;
  // timestamp = timestamp.toString().length !== 13 ? timestamp * 1000 : timestamp
  const date = new Date(timestamp);
  const Y = date.getFullYear();
  const M =
    date.getMonth() + 1 < 10
      ? "0" + (date.getMonth() + 1)
      : date.getMonth() + 1;
  const D = date.getDate();
  const h = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
  const m =
    date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
  const s =
    date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
  const dateString = Y + "-" + M + "-" + D;
  return type === "date"
    ? dateString
    : dateString + " " + h + ":" + m + ":" + s;
}
